//The MIT License
//
//Copyright (c) 2009 nodchip
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//
//The above copyright notice and this permission notice shall be included in
//all copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//THE SOFTWARE.
package tv.dyndns.kishibe.client.game;

import tv.dyndns.kishibe.client.Constant;
import tv.dyndns.kishibe.client.packet.PacketProblemData;

public class FactoryPanelQuestion {
	private static FactoryPanelQuestion INSTANCE = new FactoryPanelQuestion();

	public static FactoryPanelQuestion getINSTANCE() {
		return INSTANCE;
	}

	public PanelQuestionBase create(PacketProblemData problem, WidgetTimer widgetTimer) {
		PanelQuestionBase panelQuestion = null;

		switch (problem.type) {
		case Constant.TYPE_MARUBATU: {
			panelQuestion = new PanelQuestionMaruBatu(problem);
			break;
		}
		case Constant.TYPE_4TAKU: {
			panelQuestion = new PanelQuestion4Taku(problem);
			break;
		}
		case Constant.TYPE_RENSOU: {
			panelQuestion = new PanelQuestionRensou(problem);
			break;
		}
		case Constant.TYPE_NARABEKAE: {
			panelQuestion = new PanelQuestionNarabekae(problem);
			break;
		}
		case Constant.TYPE_MOJIPANEL: {
			panelQuestion = new PanelQuestionMojiPanel(problem);
			break;
		}
		case Constant.TYPE_TYPING: {
			panelQuestion = new PanelQuestionTyping(problem);
			break;
		}
		case Constant.TYPE_FLASH: {
			panelQuestion = new PanelQuestionCube(problem);
			break;
		}
		case Constant.TYPE_EFFECT: {
			panelQuestion = new PanelQuestionEffect(problem);
			break;
		}
		case Constant.TYPE_TATO: {
			panelQuestion = new PanelQuestionTato(problem);
			break;
		}
		case Constant.TYPE_JUNBAN: {
			panelQuestion = new PanelQuestionJunban(problem);
			break;
		}
		case Constant.TYPE_SENMUSUBI: {
			panelQuestion = new PanelQuestionSenmusubi(problem);
			break;
		}
		case Constant.TYPE_SLOT: {
			panelQuestion = new PanelQuestionSlot(problem);
			break;
		}
		case Constant.TYPE_CLICK: {
			panelQuestion = new PanelQuestionClick(problem);
			break;
		}
		case Constant.TYPE_TEGAKI: {
			panelQuestion = new PanelQuestionTegaki(problem);
			break;
		}
		default:
			break;
		}

		panelQuestion.getWidgetInput().setPanelQuestion(panelQuestion);

		if (widgetTimer != null) {
			panelQuestion.setWidgetTimer(widgetTimer);
		}

		return panelQuestion;
	}

}
